In my previous post I defined the ordered Virahanka numbers Vm,n and the unordered Virahanka numbers Um,n recursively by
Vm,n=Um,n=0for n<0 or m<0Vm,0=Um,0=1for m≥0Vm,n=m∑k=1Vm,n−kfor n>0Um,n=m∑k=1Uk,n−kfor n>0
The value of
Vm,n counts the number of
compositions
of
n with no term greater than
m, and the value of
Um,n counts the number of
partitions
of
n with no part greater than
m. (Following a standard convention, I consider the
“empty sum” having no terms to be equal to
0, which is why
Vm,0=Um,0=1; moreover,
V0,n=U0,n=0 for
n>0, because the recursive formulas above become empty sums.) Some special cases:
- V2,n is the sequence of Virahanka–Fibonacci numbers 1,1,2,3,5,8,….
- Vn,n is the total number of compositions of n (which equals 2n−1 for n≥1).
- Un,n is the total number of partitions of n (which has no known closed-form expression).
For later reference, here are partial tables of values for Vm,n and
Um,n.
Vm,n:m∖n01234567891001000000000011111111111121123581321345589311247132444811492744112481529561082084015112481631611202364646112481632631252484927112481632641272535048112481632641282555099112481632641282565111011248163264128256512
Um,n:m∖n01234567891001000000000011111111111121122334455631123457810121441123569111518235112357101318233061123571114202635711235711152128388112357111522294091123571115223041101123571115223042
There are so many fun ways to play with these collections of numbers, it’s hard to know when to stop! To limit the scope of this post, I will only consider two related notions, and those only in part: first differences, and generating functions.
First differences
Given a collection of numbers Sm,n indexed by integers m and n, and a pair (p,q)∈Z2, let
S(p,q)m,n=Sm,n−Sm−p,n−q.
From the definitions, we have for n>1
V(0,1)m,n=Vm,n−Vm,n−1=∑mk=1Vm,n−k−∑mk=1Vm,(n−1)−k=∑mk=1(Vm,n−k−Vm,(n−k)−1)=∑mk=1V(0,1)m,n−k
and so the first differences
V(0,1)m,n satisfy the same recurrence relation as the original numbers
Vm,n when
n≥2. Here is the table of values for
V(0,1)m,n.
V(0,1)m,n:m∖n01234567891001−100000000011000000000021011235813213431012361120376812541012471427521001935101248153059116228610124816316212324471012481632631262518101248163264127254910124816326412825510101248163264128256
We see that the “initial conditions” of the recurrence
V(0,1)m,n=∑mk=1V(0,1)m,n−k have shifted, so that before beginning to apply the recurrence relation, we insert one term equal to
0. But what are these numbers counting? Well,
Vm,n is the number of compositions of
n with no term greater than
m, and
Vm,n−1 is the number of compositions of
n−1 with no term greater than
m. Any composition of
n−1 can be converted to a composition of
n by adding a
1 at the end. So
V(0,1)m,n equals
the number of compositions of n that do not end with 1. Perhaps not the most interesting quantity to count, although having the recurrence formula is nice. (The same principle will lead to other interesting quantities, so don’t go away yet!)
On the other hand, V(1,0)m,n=Vm,n−Vm−1,n does have an interesting interpretation. Because Vm−1,n counts all compositions of n whose largest term is at most m−1, V(1,0)m,n equals the number of compositions of n whose largest term is exactly m. Here’s a partial table of values.
V(1,0)m,n:m∖n01234567891001000000000010111111111120012471220335488300012511234794185400001251227591275000001251228636000000125122870000000125128000000001259000000000121000000000001
One interesting feature of this table is that the entries stabilize below the line
n=2m: when
n<2m, we see that
V(1,0)m+1,n+1=V(1,0)m,n. The sequence
V(0,1)m,2m−1 begins (starting with
m=1)
1,2,5,12,28,64,144,320,704,…
The OEIS says that
this sequence comes from counting all the
1s that appear in all compositions of
m. Why should that sequence arise here? I guess that’s a mystery that will have to wait for later…
Turning to first differences of the unordered Virahanka numbers, let’s start with U(1,0)m,n.
U(1,0)m,n:m∖n0123456789100100000000001011111111112001122334453000112345784000011235695000001123576000000112357000000011238000000001129000000000111000000000001
It looks like no new numbers have appeared in this table; each row has simply been shifted to right, with the
mth row having
m new
0s at the start. Indeed, using the recurrence formula for
Um,n, we calculate that
U(1,0)m,n=Um,n−Um−1,n=∑mk=1Uk,n−k−∑m−1k=1Uk,n−k=Um,n−m
Why should this be true, from a counting perspective? Reasoning as we did with
V(1,0)m,n, we see that
U(0,1)m,n counts
the number of partitions of m whose largest part is exactly m. But if the largest part is exactly
m, then it only remains to partition
n−m using parts no greater than
m, which is exactly what
Um,n−m counts! So
U(0,1)m,n=Um,n−m.
Ok, now for taking first differences of Um,n within rows.
U(0,1)m,n:m∖n01234567891001000000000011000000000021010101010131011112122241011213243551011223355761011224366971011224467108101122447711910112244781110101122447812
Hmm, that’s curious: this is the first time we’ve seen any cases (outside of the
0th row or the
1st column) where the entries occasionally
decrease moving left to right. What exactly are we seeing? Well, any partition of
n−1 can be converted to a partition of
n by adjoining a
1, so the difference between
Um,n and
Um,n−1 is
the number of partitions of n that do not include 1 as a part and whose largest part is at most m. So,
- In row 2, we are only allowing partitions using 2, so every even number has one partition, and every odd number has zero.
- In row 3, we are only allowing partitions using 2 and 3. By hand, we find that 2, 3, 4, and 5 have one partition each, but 6 has two: 6=2+2+2=3+3. However, 7 only has one: 7=3+2+2. From this point, each time we add 6, we increase the number of possible partitions by 1, so U3,n+6=U3,n+1.
As the rows go on, the jumps down become harder to predict, in my view. But we could plug them into
the OEIS and see what comes up!
Here’s what row 4 yields.
Evidently, there is more fun to be had, looking at first differences V(p,q)(m,n) and U(p,q)m,n for other values of (p,q), second differences, and so on. But for now let’s turn to a new game.
Generating functions
Given a sequence of numbers {an}, the generating function of the sequence is the formal power series
g(x)=∑anxn.
I have not included a starting or ending index in order to allow for whatever values of
n make sense. In cases where the power series converges to an analytic function on some neighborhood of
0, this function is also called the generating function of the sequence, and the terms of the sequence are the Taylor coefficients of the function.
The Virahanka–Fibonacci numbers V2,n produce the generating function
g2(x)=∞∑n=0V2,nxn.
Because
V2,0=1,
V2,n=0 for
n<0, and
V2,n=V2,n−1+V2,n−2 for
n≥1, we can rewrite the power series as
g2(x)=1+∞∑n=1(V2,n−1+V2,n−2)xn=1+∞∑n=1V2,n−1xn+∞∑n=1V2,n−2xn=1+x∞∑n=1V2,n−1xn−1+x2∞∑n=1V2,n−2xn−2=1+x∞∑n=0V2,nxn+x2∞∑n=0V2,nxn=1+xg2(x)+x2g2(x)
and therefore
g2(x)=1+xg2(x)+x2g2(x). Solving this equation, we find
g2(x)=11−x−x2.
By a similar process, if we set
gm(x)=∞∑n=0Vm,nxn
then using
Vm,0=1 and
Vm,n=Vm,n−1+⋯+Vm,n−m for
n>0, we get
gm(x)=11−x−⋯−xm.
As
m→∞, the series
x+x2+⋯+xm that is subtracted in the denominator converges to
x/(1−x), so the generating functions converge to
g∞(x)=11−x/(1−x)=1−x1−2x.
This is precisely equivalent to
g∞(x)=1+∞∑n=12n−1xn
which is the generating function of the sequence
Vn,n to which the terms of
Vm,n stabilize as
m grows.
Now let’s find the generating functions of the Um,n sequences. For each m≥0, set
fm(x)=∞∑n=0Um,nxn
By inspection, we have
f0(x)=1andf1(x)=1+x+x2+⋯=11−x.
(These are the same as
g0(x) and
g1(x).) We know that
U2,n=U1,n−1+U2,n−2 for
n≥1, and so
f2(x)=1+∞∑n=1(U1,n−1+U2,n−2)xn=1+x∞∑n=1U1,n−1xn−1+x2∞∑n=1U2,n−2xn−2=1+x∞∑n=0U1,nxn+x2∞∑n=0U2,nxn=1+xf1(x)+x2f2(x)
This implies
(1−x2)f2(x)=1+xf1(x), or
f2(x)=(1+x1−x)11−x2=1−x+x1−x11−x2=1(1−x)(1−x2).
Proceeding inductively, a similar process shows that
fm(x)=1+xf1(x)+x2f2(x)+⋯+xmfm(x)
and therefore
fm(x)=1(1−x)(1−x2)⋯(1−xm)
for all
m≥2. On compact subsets of
(−1,1),
xm converges uniformly to
0, and so
fm converges uniformly on compact subsets of
(−1,1) to
f∞(x)=∞∏k=111−xk
which is the generating function of
Un,n, the sequence that counts all partitions of
n.
Now that we have the generating functions gm(x) and fm(x) in hand, we can have more fun! Note that
x∑anxn=∑anxn+1=∑an−1xn
and so multiplying a generating function by
x shifts all the terms of the sequence to the right by one position. (We have already used this fact above; it’s just worth making the general principle explicit.) This allows us to find the generating functions of the first differences calculated in the previous section. We’ll consider these in the reverse order from what we did previously.
For U(1,0)m,n, the generating function is
fm(x)−fm−1(x)=1(1−x)⋯(1−xm)−1(1−x)⋯(1−xm−1)=xm(1−x)⋯(1−xm)=xmfm(x)
Hey, that’s great! This matches what we just saw: the coefficients of
fm(x)−fm−1(x) are the same as those of
fm(x), but shifted
m places to the right.
For U(0,1)m,n, the generating function is
fm(x)−xfm(x)=1(1−x)⋯(1−xm)−x(1−x)⋯(1−xm)=1−x(1−x)⋯(1−xm)=1(1−x2)⋯(1−xm)
Oh, neat—we wanted a function that counts the number of partitions that don’t contain
1 as a part, and the factor
1−x vanished! This suggests that if we want to count partitions that only allow
a1,…,aN then perhaps we should use the generating function
[(1−xa1)⋯(1−xaN)]−1? Something to explore further…
Now for V(1,0)m,n, the generating function is
gm(x)−gm−1(x)=11−x−⋯−xm−11−x−⋯−xm−1=xm(1−x−⋯−xm)(1−x−⋯−xm−1)=xmgm(x)gm−1(x).
Hmm, this definitely tells us something interesting. Multiplying out the power series for
gm and
gm−1, and equating coefficients, we find
V(1,0)m,n=n−m∑k=0Vm,kVm−1,n−m−k.
Recall from our interpretation of
V(1,0)m,n that it counts the number of compositions of
n whose largest term is exactly equal to
m. Indeed, since we know the largest term is
m, we can sort the compositions by the
last term that equals
m. The sum of the terms before this will be equal to some
k≤n−m, for which there are
Vm,k compositions with no terms greater than
m. After the last term equal to
m, the remaining terms will sum to
n−k−m, for which there are
Vm−1,n−k−m compositions whose terms are all less than
m. We thus could have found this equality earlier in our study, but the generating function suggested it immediately!
(I had hoped that looking at the generating functions would also help explain why
V(1,0)m,2m−1 equals the number of
1s in all compositions of
m, as observed above, but I haven’t quite got there yet… possible update to come!)
For V(0,1)m,n, the generating function is
gm(x)−xgm(x)=11−x−⋯−xm−x1−x−⋯−xm=1−x1−x−⋯−xm
Oh, so changing the initial conditions of the sequence just corresponds to changing the numerator of the generating function. That’s neat! (Indeed, the
Lucas numbers Ln famously satisfy the same recursive formula as the Virahanka–Fibonacci numbers,
Ln=Ln−1+Ln−2, and their generating function is
(2−x)/(1−x−x2)=g2(x)+(g2(x)−xg2(x)).)
I can’t help doing one more thing with these generating functions, especially since we haven’t seen much interaction between the numbers Vm,n and Um,n. Let’s try dividing their generating functions. We know that Vm,n is at least as large as Um,n, so we’ll divide gm by fm:
gmfm=(1−x)⋯(1−xm)1−x−⋯−xm.
What could the coefficients of this generating function represent? Loosely speaking, they carry
the information about the number of compositions (with no part greater than m) that is not contained in the number of partitions. That’s fairly vague, so let’s consider the case
m=2. We calculate
g2f2=(1−x)(1−x2)1−x−x2=1+x31−x−x2=1+x3g2
which gives us the factorization
g2=f2(1+x3g2), or
g2=f2+x3f2g2. Equating coefficients of the power series yields the relation
V2,n=U2,n+n−3∑k=0U2,kV2,n−3−k.
This equation has a sensible meaning. Recall that a partition of
n can be thought of as a composition (a sum of positive integers summing to
n) in which the terms are non-increasing. (For example,
2+2+1+1+1 is a partition of
7, but
2+1+1+2+1 is not.) The right-hand side of the last equation splits the number of compositions into the number of partitions
U2,n and the number of non-partitions. If we are only allowing terms equal to
1 or
2, then a composition that is
not a partition must have a
1 followed by a
2 somewhere in its expression. In
poetic terms, we can think of
1 and
2 as short and long syllables, and
n as the number of beats in a line. We sort compositions by where the first appearance of
1+2 occurs. Everything before that in the sum is non-increasing; say this takes
k beats (this is the
U2,k factor in the sum on the right). Then we have
1+2, which accounts for
3 more beats, and finally the remaining
n−3−k beats can be subdivided in any manner using shrot and long syllables (which is what the
V2,n−3−k factor counts).
The sequence of coefficients for g4(x)/f4(x) begins
1,0,0,1,2,5,8,16,30,58,113,217,418,….
As of this writing (May 2022) this sequence
does not appear in the OEIS (should I submit it?). However, the sequence of coefficients for
g∞f∞=1+x3+2x4+5x5+9x6+19x7+37x8+74x9+148x10+⋯
does appear, as
A178841, which counts “the number of pure inverting compositions of
n.” These seem to be related to a basis for the algebra of
quasisymmetric functions as a module over the
symmetric functions. So there’s something deep and important going on with these quotients!
In case it isn’t obvious from this post, I’m still learning about generating functions, and I’m kind of in awe of them. It’s entirely possible that everything in this post appears among the exercises of some book on combinatorics. (Certainly most of them are mild generalizations of facts that can be found in the OEIS.) One of my summer activities may be to finally get through Herbert Wilf’s book generatingfunctionology (the second edition is available for free download at the link).